import 'package:flutter_test/flutter_test.dart';
import 'package:universal_platform/universal_platform.dart';

void main() {
  group('UniversalPlatform Tests', () {
    test('should not throw errors when accessing platform properties', () {
      expect(() => UniversalPlatform.isWeb, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isWindows, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isMacOS, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isLinux, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isAndroid, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isIOS, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isFuchsia, isNot(throwsA(anything)));
      expect(() => UniversalPlatform.isOhos, isNot(throwsA(anything)));
    });

    test('should return valid values for platform detection', () {
      expect(UniversalPlatform.isWeb, isA<bool>());
      expect(UniversalPlatform.isWindows, isA<bool>());
      expect(UniversalPlatform.isMacOS, isA<bool>());
      expect(UniversalPlatform.isLinux, isA<bool>());
      expect(UniversalPlatform.isAndroid, isA<bool>());
      expect(UniversalPlatform.isIOS, isA<bool>());
      expect(UniversalPlatform.isFuchsia, isA<bool>());
      expect(UniversalPlatform.isOhos, isA<bool>());
    });

    test('should return valid operating system string', () {
      expect(() => UniversalPlatform.operatingSystem, isNot(throwsA(anything)));
      expect(UniversalPlatform.operatingSystem, isA<String>());
    });

    test('should return valid platform value', () {
      expect(() => UniversalPlatform.value, isNot(throwsA(anything)));
      expect(UniversalPlatform.value, isA<UniversalPlatformType>());
    });
  });
}